const { program } = require("commander");

const {
  createProjectActions,
  createComponentsActions,
  createViewsAndRouterActions,
  // createRoutersActions,
} = require("./actions.js");

const createCommands = () => {
  program
    .command("create <project> [others...]")
    .description("克隆远程仓库创建基础模板")
    .action(createProjectActions);

  program
    .command("addcom <comname>")
    .description("创建一个vue组件 例： addcom my-button [-d src/components]")
    .action((comname) =>
      createComponentsActions(
        comname,
        program._optionValues.dest || "src/components"
      )
    );

  program
    .command("addpage <pagename>")
    .description(
      "创建一个vue页面 并设置默认路由 例： addpage loginView [-d src/views]"
    )
    .action((pagename) =>
      createViewsAndRouterActions(
        pagename,
        program._optionValues.dest || "src/views"
      )
    );
};

module.exports = {
  createCommands,
};
